// 导入数据库操作模块
const db = require('../../db/index')

// 获取所有通知   (不获取p_state为0的诗歌)
exports.getAllNotice = (req, res) => {
    // const { pageNum, pageSize } = req.body
    // let starNum = (pageNum - 1) * pageSize
    // const sql1 = `select count(distinct(pid)) as total from poetry p, author a where a.author_id=p.aid and p.p_state=1`
    // const sql2 = `select a.a_name, p.p_title, p.p_dynasty, p.p_content, p.p_analyze, p.p_translation, p.p_comment, p.p_annotation, p.p_genre, p.p_postscount, p.p_cover from poetry p, author a where a.author_id = p.aid and p.p_state=1 limit ${starNum}, ${pageSize}`
    // db.query(sql1, (err, results1) => {
    //     if(err) return res.operationSuccess('failure', 'ERR050', '获取诗歌信息失败！', err)
    //     db.query(sql2, (err, results2) => {
    //         if(err) return res.operationSuccess('failure', 'ERR050', '获取诗歌信息失败！', err)
    //         return res.operationSuccess('success', '', '获取诗歌信息成功！', {total: results1[0].total, results2: results2})
    //     })
    // })
}
